using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.SceneManagement;

public class Score : MonoBehaviour
{
        public int Cherry;
        public Text CherryNum;
        public AudioSource cherryAudio;
    // Start is called before the first frame update
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.E))
        {
           // if (Cherry >= 5)
                SceneManager.LoadScene("SelectLevel");

        }
    }

    //碰撞触发
    private void OnTriggerEnter2D(Collider2D collision)
    { 
        //收集物品
        /*if(collision.tag=="Collection")
        {
            cherryAudio.Play();
            Destroy(collision.gameObject); 
            Cherry+=1;
            CherryNum.text=Cherry.ToString();
        }*/
        if(collision.tag=="deadline")
        {
            Cherry =0;
            SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
        }
        if (collision.gameObject.tag == "enemy")
        {
            Cherry = 0;
            SceneManager.LoadScene("Level2");
        }
    }

}
